using System;
using Microsoft.WowAddonStudio.FrameXml.Serialization;
using Microsoft.WowAddonStudio.FrameXml.Serialization.LayoutFrames;
using NUnit.Framework;

namespace Microsoft.WowAddonStudio.FrameXml.Serialization.Tests
{
    [TestFixture]
    public class FrameInheritanceTest : SerializationTestBase<Frame>
    {
        [Test]
        public void FramesTest()
        {
            this.InitializeTestEntity("Simple/FrameInheritance.xml");

            Assert.AreEqual(2, TestEntity.Frames.Count);
        }


		/// <summary>
		/// Gets the entity to be tested from a <see cref="Ui"/> instance.
		/// </summary>
		/// <param name="ui">The ui instance.</param>
		/// <returns>
		/// An instance of the <typeparamref name="TSerializationObject"/> class.
		/// </returns>
        protected override Frame GetTestEntity(Ui ui)
        {
            Assert.IsNotNull(ui.LayoutFrames);
            Assert.AreEqual(2, ui.LayoutFrames.Count);

            // Ui/Frame[1]
            Assert.IsTrue(ui.LayoutFrames[1] is Frame);
            return (Frame)ui.LayoutFrames[1];
        }
    }
}
